// 实现面向对象的线程池（重点掌握Threadpool的实现）以及 实现基于对象的线程池（两者对比看看）

#include "task_queue.hh"
#include "thread_pool.hh"
#include "task.hh"
#include <iostream>
#include <memory>

using std::cout;
using std::endl;


static int cc = 1;
class MyTask
    : public Task
{
public:
    virtual void process() override { cout << cc++ << " " <<"MyTask::process()" << endl; }
    ~MyTask(){};
};


using std::unique_ptr;
int main()
{
    unique_ptr<Task> ul(new MyTask());
    Thread_pool pool(4, 10);
    pool.start();

    int count = 30;
    while(count--){ 
        pool.addTask(ul.get());
        cout << "count: " << count << endl;
    }

    pool.stop();
    return 0;
}
